package com.yc.chaoshi.cs_order.mapper;

import com.yc.chaoshi.entity.PmsFenlei1;
import com.yc.chaoshi.entity.PmsFenlei2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.chaoshi.entity.PmsFenlei3;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author xz
 * @since 2022-08-04
 */
public interface PmsFenlei2Mapper extends BaseMapper<PmsFenlei2> {

    @Select("select * from pms_fenlei1 where aid=#{aid}")
    @Results({
            // MyBatis 默认字段映射只能映射一次
            @Result(property = "aid",column = "aid"),
            @Result(property = "fenlei2s",column = "aid",
                    many = @Many(select = "selectSeconds"))
    })
    List<PmsFenlei1> selectAll1(int aid);

    @Select("select * from pms_fenlei2 where aid=#{aid}")
    @Results({
            // MyBatis 默认字段映射只能映射一次
            @Result(property = "bid",column = "bid"),
            @Result(property = "fenlei3s",column = "bid",
                    many = @Many(select = "selectThird"))
    })
    List<PmsFenlei2> selectSeconds(int aid);

    @Select("select * from pms_fenlei3 where bid=#{bid}")
    List<PmsFenlei3> selectThird(int bid);



    @Select("select * from pms_fenlei2 where aid=#{aid}")
    List<PmsFenlei2> selectByAid(int aid);



    @Select("select * from pms_fenlei2 where bid=#{bid}")
    @Results({
            // MyBatis 默认字段映射只能映射一次
            @Result(property = "bid",column = "bid"),
            @Result(property = "fenlei3s",column = "bid",
                    many = @Many(select = "selectThird2"))
    })
    List<PmsFenlei2> selectAll2(int bid);

    @Select("select * from pms_fenlei3 where bid=#{bid}")
    List<PmsFenlei3> selectThird2(int bid);


}
